-- Create sequence 
create sequence QL_SYS_LOG_LOGID_SEQ
minvalue 1
maxvalue 9999999999999999999999999999
start with 1
increment by 1
cache 20;


-- Create table
create table QL_SYS_LOG
(
  logid      NUMBER not null,
  url        VARCHAR2(255),
  ltranid    VARCHAR2(255),
  userid     VARCHAR2(255),
  username   VARCHAR2(255),
  userip     VARCHAR2(255),
  logclass   VARCHAR2(255),
  logmethod  VARCHAR2(255),
  logline    VARCHAR2(255),
  createtime VARCHAR2(255),
  loglevel   VARCHAR2(255),
  logmsg     CLOB,
  theadid    VARCHAR2(255),
  sessionid  VARCHAR2(255)
);



CREATE OR REPLACE TRIGGER ql_sys_log_INS_TRG BEFORE INSERT ON ql_sys_log FOR EACH ROW WHEN(NEW.logid IS NULL)
BEGIN
SELECT ql_sys_log_logid_SEQ.NEXTVAL INTO :NEW.logid FROM DUAL;
END;
